function jsonp(opt) {

  var script = document.createElement("script");

  var tmp = [];

  for (var key in opt.data) {
    tmp.push(`${key}=${opt.data[key]}`);
  }


  var fn = 'fn' + Math.random().toString().replace('.', '')

  tmp.push("callback=" + fn);
  var qs = tmp.join("&");

  script.src = opt.url + "?" + qs;

  document.body.appendChild(script);

  window[fn] = opt.success;


  script.onload = function () {
    document.body.removeChild(script);
    script.onload = null;
    script = null;
    delete window[fn]
  };
}